package com.hd.system.config;

import java.io.Serializable;

/**
 * 分页信息
 */
public class LocalPage implements Serializable {

	private static final long serialVersionUID = -6547334134436248960L;

	/**
	 * 每页显示数量
	 */
	private int page = 20;

	/**
	 * 当前页
	 */
	private int current = 1;

	/**
	 * 总数量
	 */
	private int count;

	/**
	 * 总页数
	 */
	private int totalPage;

	public LocalPage() {
		
	}

	public LocalPage(int page, int current, int count, int totalPage) {
		this.page = page;
		this.current = current;
		this.count = count;
		this.totalPage = totalPage;
	}
	
//	public static LocalPage toPage(List<?> obj) {
//		PageInfo<?> pageInfo = new PageInfo(obj);
//		final long total = pageInfo.getTotal();
//		return new LocalPage(pageInfo.getPageSize(), pageInfo.getPageNum(), Ints.saturatedCast(total),
//				pageInfo.getPages());
//	}
//
//	public static Map<String, Object> toPageMap(List<?> obj, LocalPage localPage) {
//		Map<String, Object> map = new HashMap<String, Object>();
//		map.put("item", obj);
//		map.put("page", localPage);
//		return map;
//	}
	
	public int getPage() {
		return page;
	}

	public void setPage(int page) {
		if (page > 100) { // 限制每页最多条数
			this.page = 20;
		} else {
			this.page = page;
		}
	}

	public int getCurrent() {
		return current;
	}

	public void setCurrent(int current) {
		this.current = current;
	}

	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}

	public int getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}

}